package com.xqboss.apps.enums.market;

import com.xqboss.common.enums.BaseEnum;
import com.xqboss.common.exception.ServiceException;

import java.util.Objects;

/**
 * @author Trent
 * @date 2023/8/17
 */
public enum MarketTypeEnum implements BaseEnum<Integer> {
    NORMAL(1, "典藏"),
    EQUIPMENT(2, "装备"),
    BOX(3, "宝盒"),
    MATERIAL(4, "材料"),
    ;

    private final String msg;
    private final Integer value;

    MarketTypeEnum(Integer value, String desc){
        this.value = value;
        this.msg = desc;
    }

    @Override
    public Integer getValue() {
        return value;
    }

    @Override
    public String getMsg() {
        return msg;
    }


    public static MarketTypeEnum valueOf(int value){
        for (MarketTypeEnum enums : MarketTypeEnum.values()) {
            if(Objects.equals(value, enums.getValue())){
                return enums;
            }
        }
        throw new ServiceException("类型错误~");
    }
}
